package tool;

//日志工具类
public class LogCat {
    private static final boolean needLog = false;
    private static final int logLevel = 4;
    public static void d(String msg){
        if(needLog){
            System.out.println(msg);
        }
    }
    public static void d1(String msg){
        if(logLevel >= 1){
            System.out.println(msg);
        }
    }
    public static void d2(String msg){
        if(logLevel >= 2){
            System.out.println(msg);
        }
    }
    public static void d3(String msg){
        if(logLevel >= 3){
            System.out.println(msg);
        }
    }
    public static void e(String msg){
        if(needLog){
            System.err.println("error: "+msg);
        }
    }


    public static void printStringWithCharsAndCodes(String input) {
        if(!needLog){
            return;
        }
        // 遍历字符串中的每个字符
        for (int i = 0; i < input.length(); i++) {
            char currentChar = input.charAt(i);
            // 打印字符及其ASCII码（或Unicode码点）
            System.out.println("字符: '" + currentChar + "', 码点: " + (int) currentChar);
        }
    }

    public static void printf1(String input) {
        if(logLevel>=1){
            return;
        }
        // 遍历字符串中的每个字符
        for (int i = 0; i < input.length(); i++) {
            char currentChar = input.charAt(i);
            // 打印字符及其ASCII码（或Unicode码点）
            System.out.println("字符: '" + currentChar + "', 码点: " + (int) currentChar);
        }
    }

    //打印一条分隔符
    public static void line(int num){
        for(int i=0;i<num;i++){
            System.out.print("-");
        }
        System.out.println();
    }

    //平方打印
    public static void forLine(int num){
        for(int i=0;i<num;i++){
            line(num);
        }
    }


    //打印一条分隔符
    public static void line(){
        for(int i=0;i<15;i++){
            System.out.print("-");
        }
        System.out.println();
    }
    //平分打印
    public static void forLine(){
        for(int i=0;i<15;i++){
            line();
        }
    }
}
